<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>The Constant Construct</title>
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
		<meta name="viewport" content="width=device-width initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Language" content="en-gb">

<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
<script>
function togglePopup(material_id) {
  var popup = document.getElementById(material_id);
  popup.classList.toggle("show");
}
</script>

<link href="../docs-assets/Popups.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
		
	</head>
	<body class="commentary-font">
		<nav role="navigation">
		<h1><a href="../index.html"><img src="../docs-assets/Inform.png" height=72> </a></h1>
<ul><li><a href="../index.html">home</a></li>
</ul><h2>Compiler</h2><ul>
<li><a href="../structure.html">structure</a></li>
<li><a href="../inbuildn.html">inbuild</a></li>
<li><a href="../inform7n.html">inform7</a></li>
<li><a href="../intern.html">inter</a></li>
<li><a href="../services.html">services</a></li>
<li><a href="../secrets.html">secrets</a></li>
</ul><h2>Other Tools</h2><ul>
<li><a href="../inblorbn.html">inblorb</a></li>
<li><a href="../inform6.html">inform6</a></li>
<li><a href="../inpolicyn.html">inpolicy</a></li>
</ul><h2>Resources</h2><ul>
<li><a href="../extensions.html">extensions</a></li>
<li><a href="../kits.html">kits</a></li>
</ul><h2>Repository</h2><ul>
<li><a href="https://github.com/ganelson/inform"><img src="../docs-assets/github.png" height=0> github</a></li>
</ul><h2>Related Projects</h2><ul>
<li><a href="https://github.com/ganelson/inweb"><img src="../docs-assets/github.png" height=0> inweb</a></li>
<li><a href="https://github.com/ganelson/intest"><img src="../docs-assets/github.png" height=0> intest</a></li>
</ul>
		</nav>
		<main role="main">
		<!-- Weave of 'The Constant Construct' generated by inweb -->
<div class="breadcrumbs">
    <ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="../intern.html">Inter Modules</a></li><li><a href="index.html">bytecode</a></li><li><a href="index.html#4">Chapter 4: Void Constructs</a></li><li><b>The Constant Construct</b></li></ul></div>
<p class="purpose">Defining the constant construct.</p>

<ul class="toc"><li><a href="4-tcc2.html#SP1">&#167;1. Definition</a></li><li><a href="4-tcc2.html#SP2">&#167;2. Instructions</a></li><li><a href="4-tcc2.html#SP6">&#167;6. Creating from textual Inter syntax</a></li><li><a href="4-tcc2.html#SP7">&#167;7. Writing to textual Inter syntax</a></li><li><a href="4-tcc2.html#SP8">&#167;8. Access functions</a></li><li><a href="4-tcc2.html#SP9">&#167;9. Definitional depth of a constant</a></li><li><a href="4-tcc2.html#SP10">&#167;10. Direct evaluation</a></li><li><a href="4-tcc2.html#SP11">&#167;11. Direct modification</a></li></ul><hr class="tocbar">

<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. Definition.</b>For what this does and why it is used, see <a href="../inter/M-ti.html" class="internal">Textual Inter (in inter)</a>.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">ConstantInstruction::define_construct</span><button class="popup" onclick="togglePopup('usagePopup1')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup1">Usage of <span class="code-font"><span class="function-syntax">ConstantInstruction::define_construct</span></span>:<br/>Inter Constructs - <a href="3-ic.html#SP15">&#167;15</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">void</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_construct</span><span class="plain-syntax"> *</span><span class="identifier-syntax">IC</span><span class="plain-syntax"> = </span><a href="3-ic.html#SP1" class="function-link"><span class="function-syntax">InterInstruction::create_construct</span></a><span class="plain-syntax">(</span><span class="constant-syntax">CONSTANT_IST</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"constant"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="3-ic.html#SP2" class="function-link"><span class="function-syntax">InterInstruction::defines_symbol_in_fields</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IC</span><span class="plain-syntax">, </span><span class="constant-syntax">DEFN_CONST_IFLD</span><span class="plain-syntax">, </span><span class="constant-syntax">TYPE_CONST_IFLD</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="3-ic.html#SP8" class="function-link"><span class="function-syntax">InterInstruction::specify_syntax</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IC</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"constant MINTOKENS = TOKENS"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="3-ic.html#SP4" class="function-link"><span class="function-syntax">InterInstruction::data_extent_at_least</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IC</span><span class="plain-syntax">, </span><span class="constant-syntax">3</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="3-ic.html#SP3" class="function-link"><span class="function-syntax">InterInstruction::permit</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IC</span><span class="plain-syntax">, </span><span class="constant-syntax">INSIDE_PLAIN_PACKAGE_ICUP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">METHOD_ADD</span><span class="plain-syntax">(</span><span class="identifier-syntax">IC</span><span class="plain-syntax">, </span><span class="constant-syntax">CONSTRUCT_READ_MTID</span><span class="plain-syntax">, </span><a href="4-tcc2.html#SP6" class="function-link"><span class="function-syntax">ConstantInstruction::read</span></a><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">METHOD_ADD</span><span class="plain-syntax">(</span><span class="identifier-syntax">IC</span><span class="plain-syntax">, </span><span class="constant-syntax">CONSTRUCT_TRANSPOSE_MTID</span><span class="plain-syntax">, </span><a href="4-tcc2.html#SP4" class="function-link"><span class="function-syntax">ConstantInstruction::transpose</span></a><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">METHOD_ADD</span><span class="plain-syntax">(</span><span class="identifier-syntax">IC</span><span class="plain-syntax">, </span><span class="constant-syntax">CONSTRUCT_VERIFY_MTID</span><span class="plain-syntax">, </span><a href="4-tcc2.html#SP5" class="function-link"><span class="function-syntax">ConstantInstruction::verify</span></a><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">METHOD_ADD</span><span class="plain-syntax">(</span><span class="identifier-syntax">IC</span><span class="plain-syntax">, </span><span class="constant-syntax">CONSTRUCT_WRITE_MTID</span><span class="plain-syntax">, </span><a href="4-tcc2.html#SP7" class="function-link"><span class="function-syntax">ConstantInstruction::write</span></a><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. Instructions.</b>In bytecode, the frame of an <span class="extract"><span class="extract-syntax">comment</span></span> instruction is laid out with the
compulsory words &mdash; see <a href="2-in.html" class="internal">Inter Nodes</a> &mdash; followed by these fields. Note
that the data then occupies a varying number of further data pairs, depending on
the value of <span class="extract"><span class="extract-syntax">FORMAT_CONST_IFLD</span></span>. As a result, the length of a <span class="extract"><span class="extract-syntax">constant</span></span>
instruction can be any odd number of words from 5 upwards.
</p>

<p class="commentary">The simplest version, though, has a single value. The length is then 7 words.
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">DEFN_CONST_IFLD</span><span class="plain-syntax">   (</span><span class="constant-syntax">DATA_IFLD</span><span class="plain-syntax"> + </span><span class="constant-syntax">0</span><span class="plain-syntax">)</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">TYPE_CONST_IFLD</span><span class="plain-syntax">   (</span><span class="constant-syntax">DATA_IFLD</span><span class="plain-syntax"> + </span><span class="constant-syntax">1</span><span class="plain-syntax">)</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">FORMAT_CONST_IFLD</span><span class="plain-syntax"> (</span><span class="constant-syntax">DATA_IFLD</span><span class="plain-syntax"> + </span><span class="constant-syntax">2</span><span class="plain-syntax">)</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">DATA_CONST_IFLD</span><span class="plain-syntax">   (</span><span class="constant-syntax">DATA_IFLD</span><span class="plain-syntax"> + </span><span class="constant-syntax">3</span><span class="plain-syntax">)</span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">inter_error_message</span><span class="plain-syntax"> *</span><span class="function-syntax">ConstantInstruction::new</span><button class="popup" onclick="togglePopup('usagePopup2')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup2">Usage of <span class="code-font"><span class="function-syntax">ConstantInstruction::new</span></span>:<br/><a href="4-tcc2.html#SP6_3">&#167;6.3</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_bookmark</span><span class="plain-syntax"> *</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_type</span><span class="plain-syntax"> </span><span class="identifier-syntax">type</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_pair</span><span class="plain-syntax"> </span><span class="identifier-syntax">val</span><span class="plain-syntax">, </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">level</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_error_location</span><span class="plain-syntax"> *</span><span class="identifier-syntax">eloc</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax"> = </span><a href="2-in.html#SP5" class="function-link"><span class="function-syntax">Inode::new_with_5_data_fields</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">, </span><span class="constant-syntax">CONSTANT_IST</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="comment-syntax">/* DEFN_CONST_IFLD: */</span><span class="plain-syntax">   </span><a href="2-st.html#SP17" class="function-link"><span class="function-syntax">InterSymbolsTable::id_at_bookmark</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">),</span>
<span class="plain-syntax">        </span><span class="comment-syntax">/* TYPE_CONST_IFLD: */</span><span class="plain-syntax">   </span><a href="3-idt.html#SP15" class="function-link"><span class="function-syntax">InterTypes::to_TID_at</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">, </span><span class="identifier-syntax">type</span><span class="plain-syntax">),</span>
<span class="plain-syntax">        </span><span class="comment-syntax">/* FORMAT_CONST_IFLD: */</span><span class="plain-syntax"> </span><span class="constant-syntax">CONST_LIST_FORMAT_NONE</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="comment-syntax">/* DATA_CONST_IFLD: */</span><span class="plain-syntax">   </span><a href="3-ivp.html#SP20" class="function-link"><span class="function-syntax">InterValuePairs::to_word1</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">val</span><span class="plain-syntax">),</span>
<span class="plain-syntax">                                 </span><a href="3-ivp.html#SP20" class="function-link"><span class="function-syntax">InterValuePairs::to_word2</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">val</span><span class="plain-syntax">),</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">, </span><span class="identifier-syntax">level</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_error_message</span><span class="plain-syntax"> *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><a href="3-vi.html#SP1" class="function-link"><span class="function-syntax">VerifyingInter::instruction</span></a><span class="plain-syntax">(</span><a href="2-bkm.html#SP6" class="function-link"><span class="function-syntax">InterBookmark::package</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">), </span><span class="identifier-syntax">P</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">E</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">E</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><a href="2-np.html#SP3" class="function-link"><span class="function-syntax">NodePlacement::move_to_moving_bookmark</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">IBM</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. </b>All other forms have a flexible number of data pairs. The number of entries
can therefore be calculated as half of (the instruction extent minus <span class="extract"><span class="extract-syntax">DATA_CONST_IFLD</span></span>).
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">CONST_LIST_FORMAT_NONE</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">CONST_LIST_FORMAT_WORDS</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">CONST_LIST_FORMAT_WORDS_BY_EXTENT</span><span class="plain-syntax"> </span><span class="constant-syntax">2</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">CONST_LIST_FORMAT_BYTES</span><span class="plain-syntax"> </span><span class="constant-syntax">3</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">CONST_LIST_FORMAT_BYTES_BY_EXTENT</span><span class="plain-syntax"> </span><span class="constant-syntax">4</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">CONST_LIST_FORMAT_B_WORDS</span><span class="plain-syntax"> </span><span class="constant-syntax">5</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">CONST_LIST_FORMAT_B_WORDS_BY_EXTENT</span><span class="plain-syntax"> </span><span class="constant-syntax">6</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">CONST_LIST_FORMAT_B_BYTES</span><span class="plain-syntax"> </span><span class="constant-syntax">7</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">CONST_LIST_FORMAT_B_BYTES_BY_EXTENT</span><span class="plain-syntax"> </span><span class="constant-syntax">8</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">CONST_LIST_FORMAT_GRAMMAR</span><span class="plain-syntax"> </span><span class="constant-syntax">9</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">CONST_LIST_FORMAT_INLINE</span><span class="plain-syntax"> </span><span class="constant-syntax">10</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">CONST_LIST_FORMAT_SUM</span><span class="plain-syntax"> </span><span class="constant-syntax">11</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">CONST_LIST_FORMAT_PRODUCT</span><span class="plain-syntax"> </span><span class="constant-syntax">12</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">CONST_LIST_FORMAT_DIFFERENCE</span><span class="plain-syntax"> </span><span class="constant-syntax">13</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">CONST_LIST_FORMAT_QUOTIENT</span><span class="plain-syntax"> </span><span class="constant-syntax">14</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">CONST_LIST_FORMAT_STRUCT</span><span class="plain-syntax"> </span><span class="constant-syntax">15</span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">ConstantInstruction::is_a_genuine_list_format</span><button class="popup" onclick="togglePopup('usagePopup3')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup3">Usage of <span class="code-font"><span class="function-syntax">ConstantInstruction::is_a_genuine_list_format</span></span>:<br/><a href="4-tcc2.html#SP5">&#167;5</a>, <a href="4-tcc2.html#SP6_4">&#167;6.4</a></span></button><span class="plain-syntax">(</span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">format</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">format</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">CONST_LIST_FORMAT_WORDS</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">format</span><span class="plain-syntax"> &lt;= </span><span class="constant-syntax">CONST_LIST_FORMAT_INLINE</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">ConstantInstruction::is_a_byte_format</span><button class="popup" onclick="togglePopup('usagePopup4')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup4">Usage of <span class="code-font"><span class="function-syntax">ConstantInstruction::is_a_byte_format</span></span>:<br/><a href="4-tcc2.html#SP7">&#167;7</a></span></button><span class="plain-syntax">(</span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">format</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">format</span><span class="plain-syntax"> == </span><span class="constant-syntax">CONST_LIST_FORMAT_BYTES</span><span class="plain-syntax">) ||</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">format</span><span class="plain-syntax"> == </span><span class="constant-syntax">CONST_LIST_FORMAT_BYTES_BY_EXTENT</span><span class="plain-syntax">) ||</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">format</span><span class="plain-syntax"> == </span><span class="constant-syntax">CONST_LIST_FORMAT_B_BYTES</span><span class="plain-syntax">) ||</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">format</span><span class="plain-syntax"> == </span><span class="constant-syntax">CONST_LIST_FORMAT_B_BYTES_BY_EXTENT</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">ConstantInstruction::is_a_by_extent_format</span><button class="popup" onclick="togglePopup('usagePopup5')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup5">Usage of <span class="code-font"><span class="function-syntax">ConstantInstruction::is_a_by_extent_format</span></span>:<br/><a href="4-tcc2.html#SP7">&#167;7</a></span></button><span class="plain-syntax">(</span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">format</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">format</span><span class="plain-syntax"> == </span><span class="constant-syntax">CONST_LIST_FORMAT_WORDS_BY_EXTENT</span><span class="plain-syntax">) ||</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">format</span><span class="plain-syntax"> == </span><span class="constant-syntax">CONST_LIST_FORMAT_BYTES_BY_EXTENT</span><span class="plain-syntax">) ||</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">format</span><span class="plain-syntax"> == </span><span class="constant-syntax">CONST_LIST_FORMAT_B_WORDS_BY_EXTENT</span><span class="plain-syntax">) ||</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">format</span><span class="plain-syntax"> == </span><span class="constant-syntax">CONST_LIST_FORMAT_B_BYTES_BY_EXTENT</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">ConstantInstruction::is_a_bounded_format</span><span class="plain-syntax">(</span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">format</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">format</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">CONST_LIST_FORMAT_B_WORDS</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">format</span><span class="plain-syntax"> &lt;= </span><span class="constant-syntax">CONST_LIST_FORMAT_B_BYTES_BY_EXTENT</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. </b>Note that the <span class="extract"><span class="extract-syntax">type</span></span> argument here should be that of the list, not of the entries.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">inter_error_message</span><span class="plain-syntax"> *</span><span class="function-syntax">ConstantInstruction::new_list</span><button class="popup" onclick="togglePopup('usagePopup6')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup6">Usage of <span class="code-font"><span class="function-syntax">ConstantInstruction::new_list</span></span>:<br/><a href="4-tcc2.html#SP6_4">&#167;6.4</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_bookmark</span><span class="plain-syntax"> *</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_type</span><span class="plain-syntax"> </span><span class="identifier-syntax">type</span><span class="plain-syntax">, </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">format</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">no_pairs</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_pair</span><span class="plain-syntax"> *</span><span class="identifier-syntax">val_array</span><span class="plain-syntax">, </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">level</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_error_location</span><span class="plain-syntax"> *</span><span class="identifier-syntax">eloc</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">format</span><span class="plain-syntax"> == </span><span class="constant-syntax">CONST_LIST_FORMAT_NONE</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"not a list"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">AP</span><span class="plain-syntax"> = </span><a href="2-in.html#SP5" class="function-link"><span class="function-syntax">Inode::new_with_3_data_fields</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">, </span><span class="constant-syntax">CONSTANT_IST</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="comment-syntax">/* DEFN_CONST_IFLD: */</span><span class="plain-syntax">   </span><a href="2-st.html#SP17" class="function-link"><span class="function-syntax">InterSymbolsTable::id_at_bookmark</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">),</span>
<span class="plain-syntax">        </span><span class="comment-syntax">/* TYPE_CONST_IFLD: */</span><span class="plain-syntax">   </span><a href="3-idt.html#SP15" class="function-link"><span class="function-syntax">InterTypes::to_TID_at</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">, </span><span class="identifier-syntax">type</span><span class="plain-syntax">),</span>
<span class="plain-syntax">        </span><span class="comment-syntax">/* FORMAT_CONST_IFLD: */</span><span class="plain-syntax"> (</span><span class="constant-syntax">inter_ti</span><span class="plain-syntax">) </span><span class="identifier-syntax">format</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">, </span><span class="identifier-syntax">level</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">pos</span><span class="plain-syntax"> = </span><span class="identifier-syntax">AP</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">extent</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><a href="2-in.html#SP12" class="function-link"><span class="function-syntax">Inode::extend_instruction_by</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">AP</span><span class="plain-syntax">, (</span><span class="constant-syntax">inter_ti</span><span class="plain-syntax">) (2*</span><span class="identifier-syntax">no_pairs</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">no_pairs</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">++, </span><span class="identifier-syntax">pos</span><span class="plain-syntax"> += </span><span class="constant-syntax">2</span><span class="plain-syntax">) </span><a href="3-ivp.html#SP19" class="function-link"><span class="function-syntax">InterValuePairs::set</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">AP</span><span class="plain-syntax">, </span><span class="identifier-syntax">pos</span><span class="plain-syntax">, </span><span class="identifier-syntax">val_array</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">]);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_error_message</span><span class="plain-syntax"> *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><a href="3-vi.html#SP1" class="function-link"><span class="function-syntax">VerifyingInter::instruction</span></a><span class="plain-syntax">(</span><a href="2-bkm.html#SP6" class="function-link"><span class="function-syntax">InterBookmark::package</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">), </span><span class="identifier-syntax">AP</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">E</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">E</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><a href="2-np.html#SP3" class="function-link"><span class="function-syntax">NodePlacement::move_to_moving_bookmark</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">AP</span><span class="plain-syntax">, </span><span class="identifier-syntax">IBM</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">ConstantInstruction::transpose</span><button class="popup" onclick="togglePopup('usagePopup7')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup7">Usage of <span class="code-font"><span class="function-syntax">ConstantInstruction::transpose</span></span>:<br/><a href="4-tcc2.html#SP1">&#167;1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_construct</span><span class="plain-syntax"> *</span><span class="identifier-syntax">IC</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> *</span><span class="identifier-syntax">grid</span><span class="plain-syntax">, </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">grid_extent</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_error_message</span><span class="plain-syntax"> **</span><span class="identifier-syntax">E</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">=</span><span class="constant-syntax">DATA_CONST_IFLD</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="function-syntax">&lt;P-&gt;</span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">extent</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">=</span><span class="identifier-syntax">i</span><span class="plain-syntax">+2)</span>
<span class="plain-syntax">        </span><a href="3-ivp.html#SP19" class="function-link"><span class="function-syntax">InterValuePairs::set</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><a href="3-ivp.html#SP21" class="function-link"><span class="function-syntax">InterValuePairs::transpose</span></a><span class="plain-syntax">(</span><a href="3-ivp.html#SP19" class="function-link"><span class="function-syntax">InterValuePairs::get</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">), </span><span class="identifier-syntax">grid</span><span class="plain-syntax">, </span><span class="identifier-syntax">grid_extent</span><span class="plain-syntax">, </span><span class="identifier-syntax">E</span><span class="plain-syntax">));</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP5" class="paragraph-anchor"></a><b>&#167;5. </b>Verification consists only of sanity checks.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">ConstantInstruction::verify</span><button class="popup" onclick="togglePopup('usagePopup8')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup8">Usage of <span class="code-font"><span class="function-syntax">ConstantInstruction::verify</span></span>:<br/><a href="4-tcc2.html#SP1">&#167;1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_construct</span><span class="plain-syntax"> *</span><span class="identifier-syntax">IC</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_package</span><span class="plain-syntax"> *</span><span class="identifier-syntax">owner</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_error_message</span><span class="plain-syntax"> **</span><span class="identifier-syntax">E</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">P</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">extent</span><span class="plain-syntax"> % </span><span class="constant-syntax">2</span><span class="plain-syntax">) != </span><span class="constant-syntax">1</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><a href="2-in.html#SP15" class="function-link"><span class="function-syntax">Inode::error</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"extent not an odd number"</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">); </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">data_fields</span><span class="plain-syntax"> = (</span><span class="identifier-syntax">P</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">extent</span><span class="plain-syntax"> - </span><span class="constant-syntax">DATA_CONST_IFLD</span><span class="plain-syntax">)/2;</span>
<span class="plain-syntax">    </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">format</span><span class="plain-syntax"> = </span><span class="identifier-syntax">P</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">instruction</span><span class="plain-syntax">[</span><span class="constant-syntax">FORMAT_CONST_IFLD</span><span class="plain-syntax">];</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">format</span><span class="plain-syntax"> == </span><span class="constant-syntax">CONST_LIST_FORMAT_NONE</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">data_fields</span><span class="plain-syntax"> != </span><span class="constant-syntax">1</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><a href="2-in.html#SP15" class="function-link"><span class="function-syntax">Inode::error</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"extent wrong"</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">); </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><a href="3-vi.html#SP6" class="function-link"><span class="function-syntax">VerifyingInter::TID_field</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">owner</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">TYPE_CONST_IFLD</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (*</span><span class="identifier-syntax">E</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">format</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">CONST_LIST_FORMAT_STRUCT</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><a href="2-in.html#SP15" class="function-link"><span class="function-syntax">Inode::error</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"no such constant format"</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">); </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">inter_type</span><span class="plain-syntax"> </span><span class="identifier-syntax">type</span><span class="plain-syntax"> = </span><a href="3-idt.html#SP14" class="function-link"><span class="function-syntax">InterTypes::from_TID_in_field</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">TYPE_CONST_IFLD</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">format</span><span class="plain-syntax"> == </span><span class="constant-syntax">CONST_LIST_FORMAT_STRUCT</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">data_fields</span><span class="plain-syntax"> != </span><a href="3-idt.html#SP13" class="function-link"><span class="function-syntax">InterTypes::type_arity</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">type</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><a href="2-in.html#SP15" class="function-link"><span class="function-syntax">Inode::error</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"extent not same as struct length"</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">); </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">=</span><span class="constant-syntax">DATA_CONST_IFLD</span><span class="plain-syntax">, </span><span class="identifier-syntax">counter</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="function-syntax">&lt;P-&gt;</span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">extent</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">=</span><span class="identifier-syntax">i</span><span class="plain-syntax">+2) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">inter_type</span><span class="plain-syntax"> </span><span class="identifier-syntax">field_type</span><span class="plain-syntax"> = </span><a href="3-idt.html#SP13" class="function-link"><span class="function-syntax">InterTypes::type_operand</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">type</span><span class="plain-syntax">, </span><span class="identifier-syntax">counter</span><span class="plain-syntax">++);</span>
<span class="plain-syntax">            *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><a href="3-vi.html#SP11" class="function-link"><span class="function-syntax">VerifyingInter::data_pair_fields</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">owner</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">field_type</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (*</span><span class="identifier-syntax">E</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">inter_type</span><span class="plain-syntax"> </span><span class="identifier-syntax">verify_type</span><span class="plain-syntax"> = </span><span class="identifier-syntax">type</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="4-tcc2.html#SP3" class="function-link"><span class="function-syntax">ConstantInstruction::is_a_genuine_list_format</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">format</span><span class="plain-syntax">))</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">verify_type</span><span class="plain-syntax"> = </span><a href="3-idt.html#SP13" class="function-link"><span class="function-syntax">InterTypes::type_operand</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">type</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">=</span><span class="constant-syntax">DATA_CONST_IFLD</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="function-syntax">&lt;P-&gt;</span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">extent</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">=</span><span class="identifier-syntax">i</span><span class="plain-syntax">+2) {</span>
<span class="plain-syntax">            *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><a href="3-vi.html#SP11" class="function-link"><span class="function-syntax">VerifyingInter::data_pair_fields</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">owner</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">, </span><span class="identifier-syntax">verify_type</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (*</span><span class="identifier-syntax">E</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP6" class="paragraph-anchor"></a><b>&#167;6. Creating from textual Inter syntax.</b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">ConstantInstruction::read</span><button class="popup" onclick="togglePopup('usagePopup9')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup9">Usage of <span class="code-font"><span class="function-syntax">ConstantInstruction::read</span></span>:<br/><a href="4-tcc2.html#SP1">&#167;1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_construct</span><span class="plain-syntax"> *</span><span class="identifier-syntax">IC</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_bookmark</span><span class="plain-syntax"> *</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_line_parse</span><span class="plain-syntax"> *</span><span class="identifier-syntax">ilp</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_error_location</span><span class="plain-syntax"> *</span><span class="identifier-syntax">eloc</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_error_message</span><span class="plain-syntax"> **</span><span class="identifier-syntax">E</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">name_text</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ilp</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">mr</span><span class="plain-syntax">.</span><span class="identifier-syntax">exp</span><span class="plain-syntax">[0], *</span><span class="identifier-syntax">value_text</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ilp</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">mr</span><span class="plain-syntax">.</span><span class="identifier-syntax">exp</span><span class="plain-syntax">[1];</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">inter_type</span><span class="plain-syntax"> </span><span class="identifier-syntax">con_type</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">con_name</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-tcc2.html#SP6_1" class="named-paragraph-link"><span class="named-paragraph">Parse the type and name</span><span class="named-paragraph-number">6.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (*</span><span class="identifier-syntax">E</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><a href="2-ann.html#SP13" class="function-link"><span class="function-syntax">SymbolAnnotation::copy_set_to_symbol</span></a><span class="plain-syntax">(&amp;(</span><span class="identifier-syntax">ilp</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">set</span><span class="plain-syntax">), </span><span class="identifier-syntax">con_name</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">inter_pair</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pairs</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> **</span><span class="identifier-syntax">tokens</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">fmt</span><span class="plain-syntax"> = </span><span class="constant-syntax">CONST_LIST_FORMAT_NONE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">capacity</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="identifier-syntax">token_count</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax"> = </span><span class="identifier-syntax">value_text</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="4-tcc2.html#SP6_2" class="named-paragraph-link"><span class="named-paragraph">Tokenise the value</span><span class="named-paragraph-number">6.2</span></a></span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax">) </span><span class="named-paragraph-container code-font"><a href="4-tcc2.html#SP6_3" class="named-paragraph-link"><span class="named-paragraph">A single-token constant</span><span class="named-paragraph-number">6.3</span></a></span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="named-paragraph-container code-font"><a href="4-tcc2.html#SP6_4" class="named-paragraph-link"><span class="named-paragraph">A list-of-tokens constant</span><span class="named-paragraph-number">6.4</span></a></span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">token_count</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Memory::I7_free</span><span class="plain-syntax">(</span><span class="identifier-syntax">pairs</span><span class="plain-syntax">, </span><span class="constant-syntax">INTER_SYMBOLS_MREASON</span><span class="plain-syntax">, </span><span class="identifier-syntax">capacity</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Memory::I7_free</span><span class="plain-syntax">(</span><span class="identifier-syntax">tokens</span><span class="plain-syntax">, </span><span class="constant-syntax">INTER_SYMBOLS_MREASON</span><span class="plain-syntax">, </span><span class="identifier-syntax">capacity</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP6_1" class="paragraph-anchor"></a><b>&#167;6.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Parse the type and name</span><span class="named-paragraph-number">6.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">type_text</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">match_results</span><span class="plain-syntax"> </span><span class="identifier-syntax">mr</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Regexp::create_mr</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Regexp::match</span><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr</span><span class="plain-syntax">, </span><span class="identifier-syntax">name_text</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"%((%c+)%) (%c+)"</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">type_text</span><span class="plain-syntax"> = </span><span class="identifier-syntax">mr</span><span class="plain-syntax">.</span><span class="identifier-syntax">exp</span><span class="plain-syntax">[0];</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">name_text</span><span class="plain-syntax"> = </span><span class="identifier-syntax">mr</span><span class="plain-syntax">.</span><span class="identifier-syntax">exp</span><span class="plain-syntax">[1];</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">con_type</span><span class="plain-syntax"> = </span><a href="3-idt.html#SP19" class="function-link"><span class="function-syntax">InterTypes::parse_simple</span></a><span class="plain-syntax">(</span><a href="2-bkm.html#SP7" class="function-link"><span class="function-syntax">InterBookmark::scope</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">), </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">, </span><span class="identifier-syntax">type_text</span><span class="plain-syntax">, </span><span class="identifier-syntax">E</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (*</span><span class="identifier-syntax">E</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">con_name</span><span class="plain-syntax"> = </span><a href="3-iitf.html#SP4" class="function-link"><span class="function-syntax">TextualInter::new_symbol</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">eloc</span><span class="plain-syntax">, </span><a href="2-bkm.html#SP7" class="function-link"><span class="function-syntax">InterBookmark::scope</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">), </span><span class="identifier-syntax">name_text</span><span class="plain-syntax">, </span><span class="identifier-syntax">E</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Regexp::dispose_of</span><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-tcc2.html#SP6">&#167;6</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP6_2" class="paragraph-anchor"></a><b>&#167;6.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Tokenise the value</span><span class="named-paragraph-number">6.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">match_results</span><span class="plain-syntax"> </span><span class="identifier-syntax">mr2</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Regexp::create_mr</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Regexp::match</span><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr2</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"sum{ *(%c*?) *}"</span><span class="plain-syntax">)) </span><span class="identifier-syntax">fmt</span><span class="plain-syntax"> = </span><span class="constant-syntax">CONST_LIST_FORMAT_SUM</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Regexp::match</span><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr2</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"product{ *(%c*) *}"</span><span class="plain-syntax">)) </span><span class="identifier-syntax">fmt</span><span class="plain-syntax"> = </span><span class="constant-syntax">CONST_LIST_FORMAT_PRODUCT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Regexp::match</span><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr2</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"difference{ *(%c*) *}"</span><span class="plain-syntax">)) </span><span class="identifier-syntax">fmt</span><span class="plain-syntax"> = </span><span class="constant-syntax">CONST_LIST_FORMAT_DIFFERENCE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Regexp::match</span><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr2</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"quotient{ *(%c*) *}"</span><span class="plain-syntax">)) </span><span class="identifier-syntax">fmt</span><span class="plain-syntax"> = </span><span class="constant-syntax">CONST_LIST_FORMAT_QUOTIENT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Regexp::match</span><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr2</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"grammar{ *(%c*) *}"</span><span class="plain-syntax">)) </span><span class="identifier-syntax">fmt</span><span class="plain-syntax"> = </span><span class="constant-syntax">CONST_LIST_FORMAT_GRAMMAR</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Regexp::match</span><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr2</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"inline{ *(%c*) *}"</span><span class="plain-syntax">)) </span><span class="identifier-syntax">fmt</span><span class="plain-syntax"> = </span><span class="constant-syntax">CONST_LIST_FORMAT_INLINE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Regexp::match</span><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr2</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"{ *(%c*?) *}"</span><span class="plain-syntax">)) </span><span class="identifier-syntax">fmt</span><span class="plain-syntax"> = </span><span class="constant-syntax">CONST_LIST_FORMAT_WORDS</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Regexp::match</span><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr2</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"bytes{ *(%c*?) *}"</span><span class="plain-syntax">)) </span><span class="identifier-syntax">fmt</span><span class="plain-syntax"> = </span><span class="constant-syntax">CONST_LIST_FORMAT_BYTES</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Regexp::match</span><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr2</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"list of *(%c*?) bytes"</span><span class="plain-syntax">)) </span><span class="identifier-syntax">fmt</span><span class="plain-syntax"> = </span><span class="constant-syntax">CONST_LIST_FORMAT_BYTES_BY_EXTENT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Regexp::match</span><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr2</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"list of *(%c*?) words"</span><span class="plain-syntax">)) </span><span class="identifier-syntax">fmt</span><span class="plain-syntax"> = </span><span class="constant-syntax">CONST_LIST_FORMAT_WORDS_BY_EXTENT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Regexp::match</span><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr2</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"bounded { *(%c*?) *}"</span><span class="plain-syntax">)) </span><span class="identifier-syntax">fmt</span><span class="plain-syntax"> = </span><span class="constant-syntax">CONST_LIST_FORMAT_B_WORDS</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Regexp::match</span><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr2</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"bounded bytes{ *(%c*?) *}"</span><span class="plain-syntax">)) </span><span class="identifier-syntax">fmt</span><span class="plain-syntax"> = </span><span class="constant-syntax">CONST_LIST_FORMAT_B_BYTES</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Regexp::match</span><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr2</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"bounded list of *(%c*?) bytes"</span><span class="plain-syntax">)) </span><span class="identifier-syntax">fmt</span><span class="plain-syntax"> = </span><span class="constant-syntax">CONST_LIST_FORMAT_B_BYTES_BY_EXTENT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Regexp::match</span><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr2</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"bounded list of *(%c*?) words"</span><span class="plain-syntax">)) </span><span class="identifier-syntax">fmt</span><span class="plain-syntax"> = </span><span class="constant-syntax">CONST_LIST_FORMAT_B_WORDS_BY_EXTENT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Regexp::match</span><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr2</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"struct{ *(%c*?) *}"</span><span class="plain-syntax">)) </span><span class="identifier-syntax">fmt</span><span class="plain-syntax"> = </span><span class="constant-syntax">CONST_LIST_FORMAT_STRUCT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">fmt</span><span class="plain-syntax"> != </span><span class="constant-syntax">CONST_LIST_FORMAT_NONE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">S</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">conts</span><span class="plain-syntax"> = </span><span class="identifier-syntax">mr2</span><span class="plain-syntax">.</span><span class="identifier-syntax">exp</span><span class="plain-syntax">[0];</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">match_results</span><span class="plain-syntax"> </span><span class="identifier-syntax">mr3</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Regexp::create_mr</span><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">while</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Regexp::match</span><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr3</span><span class="plain-syntax">, </span><span class="identifier-syntax">conts</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"(%c+?), *(%c+)"</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><span class="named-paragraph-container code-font"><a href="4-tcc2.html#SP6_2_1" class="named-paragraph-link"><span class="named-paragraph">Add a token</span><span class="named-paragraph-number">6.2.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Str::copy</span><span class="plain-syntax">(</span><span class="identifier-syntax">conts</span><span class="plain-syntax">, </span><span class="identifier-syntax">mr3</span><span class="plain-syntax">.</span><span class="identifier-syntax">exp</span><span class="plain-syntax">[1]);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Regexp::match</span><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr3</span><span class="plain-syntax">, </span><span class="identifier-syntax">conts</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">" *(%c+?) *"</span><span class="plain-syntax">)) </span><span class="named-paragraph-container code-font"><a href="4-tcc2.html#SP6_2_1" class="named-paragraph-link"><span class="named-paragraph">Add a token</span><span class="named-paragraph-number">6.2.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Regexp::dispose_of</span><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr3</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-tcc2.html#SP6">&#167;6</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP6_2_1" class="paragraph-anchor"></a><b>&#167;6.2.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Add a token</span><span class="named-paragraph-number">6.2.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">token_count</span><span class="plain-syntax"> &gt;= </span><span class="identifier-syntax">capacity</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">new_size</span><span class="plain-syntax"> = </span><span class="constant-syntax">16</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">while</span><span class="plain-syntax"> (</span><span class="identifier-syntax">token_count</span><span class="plain-syntax"> &gt;= </span><span class="identifier-syntax">new_size</span><span class="plain-syntax">) </span><span class="identifier-syntax">new_size</span><span class="plain-syntax"> = </span><span class="identifier-syntax">new_size</span><span class="plain-syntax"> * </span><span class="constant-syntax">4</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">inter_pair</span><span class="plain-syntax"> *</span><span class="identifier-syntax">enlarged_pairs</span><span class="plain-syntax"> = (</span><span class="reserved-syntax">inter_pair</span><span class="plain-syntax"> *)</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Memory::calloc</span><span class="plain-syntax">(</span><span class="identifier-syntax">new_size</span><span class="plain-syntax">, </span><span class="reserved-syntax">sizeof</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_pair</span><span class="plain-syntax">), </span><span class="constant-syntax">INTER_SYMBOLS_MREASON</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> **</span><span class="identifier-syntax">enlarged_tokens</span><span class="plain-syntax"> = (</span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> **)</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Memory::calloc</span><span class="plain-syntax">(</span><span class="identifier-syntax">new_size</span><span class="plain-syntax">, </span><span class="reserved-syntax">sizeof</span><span class="plain-syntax">(</span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *), </span><span class="constant-syntax">INTER_SYMBOLS_MREASON</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">new_size</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">++)</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> &lt; </span><span class="identifier-syntax">capacity</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">enlarged_pairs</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">] = </span><span class="identifier-syntax">pairs</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">];</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">enlarged_tokens</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">] = </span><span class="identifier-syntax">tokens</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">];</span>
<span class="plain-syntax">            } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">enlarged_pairs</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">] = </span><a href="3-ivp.html#SP17" class="function-link"><span class="function-syntax">InterValuePairs::undef</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">enlarged_tokens</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">] = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">capacity</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Memory::I7_free</span><span class="plain-syntax">(</span><span class="identifier-syntax">pairs</span><span class="plain-syntax">, </span><span class="constant-syntax">INTER_SYMBOLS_MREASON</span><span class="plain-syntax">, </span><span class="identifier-syntax">capacity</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Memory::I7_free</span><span class="plain-syntax">(</span><span class="identifier-syntax">tokens</span><span class="plain-syntax">, </span><span class="constant-syntax">INTER_SYMBOLS_MREASON</span><span class="plain-syntax">, </span><span class="identifier-syntax">capacity</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">capacity</span><span class="plain-syntax"> = </span><span class="identifier-syntax">new_size</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">pairs</span><span class="plain-syntax"> = </span><span class="identifier-syntax">enlarged_pairs</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">tokens</span><span class="plain-syntax"> = </span><span class="identifier-syntax">enlarged_tokens</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">pairs</span><span class="plain-syntax">[</span><span class="identifier-syntax">token_count</span><span class="plain-syntax">] = </span><a href="3-ivp.html#SP17" class="function-link"><span class="function-syntax">InterValuePairs::undef</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">tokens</span><span class="plain-syntax">[</span><span class="identifier-syntax">token_count</span><span class="plain-syntax">++] = </span><span class="identifier-syntax">Str::duplicate</span><span class="plain-syntax">(</span><span class="identifier-syntax">mr3</span><span class="plain-syntax">.</span><span class="identifier-syntax">exp</span><span class="plain-syntax">[0]);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-tcc2.html#SP6_2">&#167;6.2</a> (twice).</li></ul>
<p class="commentary firstcommentary"><a id="SP6_3" class="paragraph-anchor"></a><b>&#167;6.3. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">A single-token constant</span><span class="named-paragraph-number">6.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_pair</span><span class="plain-syntax"> </span><span class="identifier-syntax">val</span><span class="plain-syntax"> = </span><a href="3-ivp.html#SP17" class="function-link"><span class="function-syntax">InterValuePairs::undef</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><a href="3-iitf.html#SP12" class="function-link"><span class="function-syntax">TextualInter::parse_pair</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">ilp</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">line</span><span class="plain-syntax">, </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">, </span><span class="identifier-syntax">IBM</span><span class="plain-syntax">, </span><span class="identifier-syntax">con_type</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, &amp;</span><span class="identifier-syntax">val</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (*</span><span class="identifier-syntax">E</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><a href="4-tcc2.html#SP2" class="function-link"><span class="function-syntax">ConstantInstruction::new</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">, </span><span class="identifier-syntax">con_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">con_type</span><span class="plain-syntax">, </span><span class="identifier-syntax">val</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            (</span><span class="constant-syntax">inter_ti</span><span class="plain-syntax">) </span><span class="identifier-syntax">ilp</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">indent_level</span><span class="plain-syntax">, </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-tcc2.html#SP6">&#167;6</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP6_4" class="paragraph-anchor"></a><b>&#167;6.4. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">A list-of-tokens constant</span><span class="named-paragraph-number">6.4</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">token_count</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">inter_type</span><span class="plain-syntax"> </span><span class="identifier-syntax">term_type</span><span class="plain-syntax"> = </span><span class="identifier-syntax">con_type</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="4-tcc2.html#SP3" class="function-link"><span class="function-syntax">ConstantInstruction::is_a_genuine_list_format</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">fmt</span><span class="plain-syntax">))</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">term_type</span><span class="plain-syntax"> = </span><a href="3-idt.html#SP13" class="function-link"><span class="function-syntax">InterTypes::type_operand</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">con_type</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">fmt</span><span class="plain-syntax"> == </span><span class="constant-syntax">CONST_LIST_FORMAT_STRUCT</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">term_type</span><span class="plain-syntax"> = </span><a href="3-idt.html#SP13" class="function-link"><span class="function-syntax">InterTypes::type_operand</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">con_type</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><a href="3-iitf.html#SP12" class="function-link"><span class="function-syntax">TextualInter::parse_pair</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">ilp</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">line</span><span class="plain-syntax">, </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">, </span><span class="identifier-syntax">IBM</span><span class="plain-syntax">, </span><span class="identifier-syntax">term_type</span><span class="plain-syntax">, </span><span class="identifier-syntax">tokens</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">], &amp;(</span><span class="identifier-syntax">pairs</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">]));</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (*</span><span class="identifier-syntax">E</span><span class="plain-syntax">) </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (*</span><span class="identifier-syntax">E</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><a href="4-tcc2.html#SP4" class="function-link"><span class="function-syntax">ConstantInstruction::new_list</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">, </span><span class="identifier-syntax">con_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">con_type</span><span class="plain-syntax">, </span><span class="identifier-syntax">fmt</span><span class="plain-syntax">, </span><span class="identifier-syntax">token_count</span><span class="plain-syntax">, </span><span class="identifier-syntax">pairs</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            (</span><span class="constant-syntax">inter_ti</span><span class="plain-syntax">) </span><span class="identifier-syntax">ilp</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">indent_level</span><span class="plain-syntax">, </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="4-tcc2.html#SP6">&#167;6</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP7" class="paragraph-anchor"></a><b>&#167;7. Writing to textual Inter syntax.</b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">ConstantInstruction::write</span><button class="popup" onclick="togglePopup('usagePopup10')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup10">Usage of <span class="code-font"><span class="function-syntax">ConstantInstruction::write</span></span>:<br/><a href="4-tcc2.html#SP1">&#167;1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_construct</span><span class="plain-syntax"> *</span><span class="identifier-syntax">IC</span><span class="plain-syntax">, </span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">con_name</span><span class="plain-syntax"> = </span><a href="4-tcc2.html#SP8" class="function-link"><span class="function-syntax">ConstantInstruction::symbol</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"constant "</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="3-iitf.html#SP13" class="function-link"><span class="function-syntax">TextualInter::write_optional_type_marker</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">TYPE_CONST_IFLD</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"%S = "</span><span class="plain-syntax">, </span><a href="2-sym.html#SP19" class="function-link"><span class="function-syntax">InterSymbol::identifier</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">con_name</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">fmt</span><span class="plain-syntax"> = </span><span class="identifier-syntax">P</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">instruction</span><span class="plain-syntax">[</span><span class="constant-syntax">FORMAT_CONST_IFLD</span><span class="plain-syntax">];</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">fmt</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">CONST_LIST_FORMAT_SUM:</span><span class="plain-syntax">               </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"sum"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">CONST_LIST_FORMAT_PRODUCT:</span><span class="plain-syntax">           </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"product"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">CONST_LIST_FORMAT_DIFFERENCE:</span><span class="plain-syntax">        </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"difference"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">CONST_LIST_FORMAT_QUOTIENT:</span><span class="plain-syntax">          </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"quotient"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">CONST_LIST_FORMAT_GRAMMAR:</span><span class="plain-syntax">           </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"grammar"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">CONST_LIST_FORMAT_INLINE:</span><span class="plain-syntax">            </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"inline"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">CONST_LIST_FORMAT_STRUCT:</span><span class="plain-syntax">            </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"struct"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">CONST_LIST_FORMAT_BYTES:</span><span class="plain-syntax">             </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"bytes"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">CONST_LIST_FORMAT_WORDS_BY_EXTENT:</span><span class="plain-syntax">   </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"list of "</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">CONST_LIST_FORMAT_BYTES_BY_EXTENT:</span><span class="plain-syntax">   </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"list of "</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">CONST_LIST_FORMAT_B_WORDS:</span><span class="plain-syntax">           </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"bounded "</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">CONST_LIST_FORMAT_B_BYTES:</span><span class="plain-syntax">           </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"bounded bytes"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">CONST_LIST_FORMAT_B_WORDS_BY_EXTENT:</span><span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"bounded list of "</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">CONST_LIST_FORMAT_B_BYTES_BY_EXTENT:</span><span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"bounded list of "</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">braced</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">fmt</span><span class="plain-syntax"> != </span><span class="constant-syntax">CONST_LIST_FORMAT_NONE</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">        (</span><a href="4-tcc2.html#SP3" class="function-link"><span class="function-syntax">ConstantInstruction::is_a_by_extent_format</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">fmt</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">)) </span><span class="identifier-syntax">braced</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">braced</span><span class="plain-syntax">) </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"{"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">=</span><span class="constant-syntax">DATA_CONST_IFLD</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="function-syntax">&lt;P-&gt;</span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">extent</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">=</span><span class="identifier-syntax">i</span><span class="plain-syntax">+2) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">DATA_CONST_IFLD</span><span class="plain-syntax">) </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">","</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">braced</span><span class="plain-syntax">) </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">" "</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="3-iitf.html#SP12" class="function-link"><span class="function-syntax">TextualInter::write_pair</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><a href="3-ivp.html#SP19" class="function-link"><span class="function-syntax">InterValuePairs::get</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">braced</span><span class="plain-syntax">) </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">" }"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="4-tcc2.html#SP3" class="function-link"><span class="function-syntax">ConstantInstruction::is_a_by_extent_format</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">fmt</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="4-tcc2.html#SP3" class="function-link"><span class="function-syntax">ConstantInstruction::is_a_byte_format</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">fmt</span><span class="plain-syntax">)) </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">" bytes"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">" words"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP8" class="paragraph-anchor"></a><b>&#167;8. Access functions.</b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="function-syntax">ConstantInstruction::symbol</span><button class="popup" onclick="togglePopup('usagePopup11')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup11">Usage of <span class="code-font"><span class="function-syntax">ConstantInstruction::symbol</span></span>:<br/><a href="4-tcc2.html#SP7">&#167;7</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-in.html#SP13" class="function-link"><span class="function-syntax">Inode::is</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">CONSTANT_IST</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="2-st.html#SP14" class="function-link"><span class="function-syntax">InterSymbolsTable::symbol_from_ID_at_node</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">DEFN_CONST_IFLD</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="function-syntax">ConstantInstruction::list_format</span><button class="popup" onclick="togglePopup('usagePopup12')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup12">Usage of <span class="code-font"><span class="function-syntax">ConstantInstruction::list_format</span></span>:<br/>Metadata - <a href="3-mtd.html#SP4_1">&#167;4.1</a>, <a href="3-mtd.html#SP5_1">&#167;5.1</a>, <a href="3-mtd.html#SP6_1">&#167;6.1</a>, <a href="3-mtd.html#SP7">&#167;7</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-in.html#SP13" class="function-link"><span class="function-syntax">Inode::is</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">CONSTANT_IST</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">P</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">instruction</span><span class="plain-syntax">[</span><span class="constant-syntax">FORMAT_CONST_IFLD</span><span class="plain-syntax">];</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">CONST_LIST_FORMAT_NONE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">inter_pair</span><span class="plain-syntax"> </span><span class="function-syntax">ConstantInstruction::constant</span><button class="popup" onclick="togglePopup('usagePopup13')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup13">Usage of <span class="code-font"><span class="function-syntax">ConstantInstruction::constant</span></span>:<br/><a href="4-tcc2.html#SP10">&#167;10</a><br/>Metadata - <a href="3-mtd.html#SP4_1">&#167;4.1</a>, <a href="3-mtd.html#SP5_1">&#167;5.1</a>, <a href="3-mtd.html#SP6_1">&#167;6.1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><a href="2-in.html#SP13" class="function-link"><span class="function-syntax">Inode::is</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">CONSTANT_IST</span><span class="plain-syntax">)) &amp;&amp;</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">P</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">instruction</span><span class="plain-syntax">[</span><span class="constant-syntax">FORMAT_CONST_IFLD</span><span class="plain-syntax">] == </span><span class="constant-syntax">CONST_LIST_FORMAT_NONE</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="3-ivp.html#SP19" class="function-link"><span class="function-syntax">InterValuePairs::get</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">DATA_CONST_IFLD</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="3-ivp.html#SP17" class="function-link"><span class="function-syntax">InterValuePairs::undef</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">ConstantInstruction::set_constant</span><button class="popup" onclick="togglePopup('usagePopup14')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup14">Usage of <span class="code-font"><span class="function-syntax">ConstantInstruction::set_constant</span></span>:<br/><a href="4-tcc2.html#SP11">&#167;11</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_pair</span><span class="plain-syntax"> </span><span class="identifier-syntax">val</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><a href="2-in.html#SP13" class="function-link"><span class="function-syntax">Inode::is</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">CONSTANT_IST</span><span class="plain-syntax">)) &amp;&amp;</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">P</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">instruction</span><span class="plain-syntax">[</span><span class="constant-syntax">FORMAT_CONST_IFLD</span><span class="plain-syntax">] == </span><span class="constant-syntax">CONST_LIST_FORMAT_NONE</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><a href="3-ivp.html#SP19" class="function-link"><span class="function-syntax">InterValuePairs::set</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">DATA_CONST_IFLD</span><span class="plain-syntax">, </span><span class="identifier-syntax">val</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"tried to set value for non-constant"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">ConstantInstruction::set_type</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_type</span><span class="plain-syntax"> </span><span class="identifier-syntax">type</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">P</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">instruction</span><span class="plain-syntax">[</span><span class="constant-syntax">TYPE_CONST_IFLD</span><span class="plain-syntax">] =</span>
<span class="plain-syntax">        </span><a href="3-idt.html#SP15" class="function-link"><span class="function-syntax">InterTypes::to_TID</span></a><span class="plain-syntax">(</span><a href="2-pck.html#SP10" class="function-link"><span class="function-syntax">InterPackage::scope</span></a><span class="plain-syntax">(</span><a href="2-in.html#SP6" class="function-link"><span class="function-syntax">Inode::get_package</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">)), </span><span class="identifier-syntax">type</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">ConstantInstruction::list_len</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">P</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) || (</span><a href="2-in.html#SP13" class="function-link"><span class="function-syntax">Inode::isnt</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">CONSTANT_IST</span><span class="plain-syntax">)) ||</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">P</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">instruction</span><span class="plain-syntax">[</span><span class="constant-syntax">FORMAT_CONST_IFLD</span><span class="plain-syntax">] == </span><span class="constant-syntax">CONST_LIST_FORMAT_NONE</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> (</span><span class="identifier-syntax">P</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">extent</span><span class="plain-syntax"> - </span><span class="constant-syntax">DATA_CONST_IFLD</span><span class="plain-syntax">)/2;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">inter_pair</span><span class="plain-syntax"> </span><span class="function-syntax">ConstantInstruction::list_entry</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">P</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) || (</span><a href="2-in.html#SP13" class="function-link"><span class="function-syntax">Inode::isnt</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">CONSTANT_IST</span><span class="plain-syntax">)) ||</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">P</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">instruction</span><span class="plain-syntax">[</span><span class="constant-syntax">FORMAT_CONST_IFLD</span><span class="plain-syntax">] == </span><span class="constant-syntax">CONST_LIST_FORMAT_NONE</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="3-ivp.html#SP17" class="function-link"><span class="function-syntax">InterValuePairs::undef</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">field</span><span class="plain-syntax"> = </span><span class="constant-syntax">DATA_CONST_IFLD</span><span class="plain-syntax"> + </span><span class="identifier-syntax">i</span><span class="plain-syntax">*2;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">field</span><span class="plain-syntax"> &gt;= </span><span class="identifier-syntax">P</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">extent</span><span class="plain-syntax">) </span><a href="3-ivp.html#SP17" class="function-link"><span class="function-syntax">InterValuePairs::undef</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="3-ivp.html#SP19" class="function-link"><span class="function-syntax">InterValuePairs::get</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">field</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">ConstantInstruction::is_inline</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">const_s</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">const_s</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">const_s</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">definition</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">        (</span><a href="4-tcc2.html#SP8" class="function-link"><span class="function-syntax">ConstantInstruction::list_format</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">const_s</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">definition</span><span class="plain-syntax">) ==</span>
<span class="plain-syntax">            </span><span class="constant-syntax">CONST_LIST_FORMAT_INLINE</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP9" class="paragraph-anchor"></a><b>&#167;9. Definitional depth of a constant.</b>Constants given explicit values have depth 1. Constants defined as equal to
other constants have depth 1 more than those other constants. Constants equal
to lists have depth 1 more than the sum of the depths of the values in the
lists. For example, if:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">constant</span><span class="plain-syntax"> x = </span><span class="constant-syntax">23</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">constant</span><span class="plain-syntax"> y = x</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">constant</span><span class="plain-syntax"> z = { x, y, </span><span class="constant-syntax">17</span><span class="plain-syntax"> }</span>
</pre>
<p class="commentary">then <span class="extract"><span class="extract-syntax">x</span></span> has depth 1, <span class="extract"><span class="extract-syntax">y</span></span> has depth 1+1 = 2, and <span class="extract"><span class="extract-syntax">z</span></span> has depth 1+(1+2+1) = 5.
It is a requirement that every constant must always have finite depth. The
point of this is to guarantee that if constant declarations are written in
ascending order of depth then no definition will refer to a constant yet to
be defined.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">ConstantInstruction::constant_depth</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">con</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">con</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOG_INDENT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">d</span><span class="plain-syntax"> = </span><a href="4-tcc2.html#SP9" class="function-link"><span class="function-syntax">ConstantInstruction::constant_depth_r</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">con</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOGIF</span><span class="plain-syntax">(</span><span class="identifier-syntax">CONSTANT_DEPTH_CALCULATION</span><span class="plain-syntax">, </span><span class="string-syntax">"%S has depth %d\n"</span><span class="plain-syntax">, </span><a href="2-sym.html#SP19" class="function-link"><span class="function-syntax">InterSymbol::identifier</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">con</span><span class="plain-syntax">), </span><span class="identifier-syntax">d</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOG_OUTDENT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">d</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">ConstantInstruction::constant_depth_r</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">con</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">total</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">D</span><span class="plain-syntax"> = </span><a href="2-sym.html#SP15" class="function-link"><span class="function-syntax">InterSymbol::definition</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">con</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><a href="2-in.html#SP13" class="function-link"><span class="function-syntax">Inode::is</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">D</span><span class="plain-syntax">, </span><span class="constant-syntax">CONSTANT_IST</span><span class="plain-syntax">)))</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">=</span><span class="constant-syntax">DATA_CONST_IFLD</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="function-syntax">&lt;D-&gt;</span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">extent</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">=</span><span class="identifier-syntax">i</span><span class="plain-syntax">+2) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">inter_pair</span><span class="plain-syntax"> </span><span class="identifier-syntax">val</span><span class="plain-syntax"> = </span><a href="3-ivp.html#SP19" class="function-link"><span class="function-syntax">InterValuePairs::get</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">D</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="3-ivp.html#SP14" class="function-link"><span class="function-syntax">InterValuePairs::is_symbolic</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">val</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">alias</span><span class="plain-syntax"> = </span><a href="3-ivp.html#SP13" class="function-link"><span class="function-syntax">InterValuePairs::to_symbol_at</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">val</span><span class="plain-syntax">, </span><span class="identifier-syntax">D</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">total</span><span class="plain-syntax"> += </span><a href="4-tcc2.html#SP9" class="function-link"><span class="function-syntax">ConstantInstruction::constant_depth</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">alias</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">total</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">total</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP10" class="paragraph-anchor"></a><b>&#167;10. Direct evaluation.</b>Some numerical constants can be evaluated at compile-time: for example, given
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">constant</span><span class="plain-syntax"> x = </span><span class="constant-syntax">23</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">constant</span><span class="plain-syntax"> y = x + </span><span class="constant-syntax">3</span>
</pre>
<p class="commentary">the following function would return 23 and 26 on <span class="extract"><span class="extract-syntax">x</span></span> and <span class="extract"><span class="extract-syntax">y</span></span> respectively. On
anything non-numerical the function aims to return 0, but this should probably
not be relied on.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">ConstantInstruction::evaluate_to_int</span><button class="popup" onclick="togglePopup('usagePopup15')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup15">Usage of <span class="code-font"><span class="function-syntax">ConstantInstruction::evaluate_to_int</span></span>:<br/>Symbols - <a href="2-sym.html#SP17">&#167;17</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax"> = </span><a href="2-sym.html#SP15" class="function-link"><span class="function-syntax">InterSymbol::definition</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><a href="2-in.html#SP13" class="function-link"><span class="function-syntax">Inode::is</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">CONSTANT_IST</span><span class="plain-syntax">)) &amp;&amp;</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">P</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">instruction</span><span class="plain-syntax">[</span><span class="constant-syntax">FORMAT_CONST_IFLD</span><span class="plain-syntax">] == </span><span class="constant-syntax">CONST_LIST_FORMAT_NONE</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">inter_pair</span><span class="plain-syntax"> </span><span class="identifier-syntax">val</span><span class="plain-syntax"> = </span><a href="3-ivp.html#SP19" class="function-link"><span class="function-syntax">InterValuePairs::get</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">DATA_CONST_IFLD</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="3-ivp.html#SP5" class="function-link"><span class="function-syntax">InterValuePairs::is_number</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">val</span><span class="plain-syntax">))</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax">) </span><a href="3-ivp.html#SP4" class="function-link"><span class="function-syntax">InterValuePairs::to_number</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">val</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="3-ivp.html#SP14" class="function-link"><span class="function-syntax">InterValuePairs::is_symbolic</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">val</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">inter_symbols_table</span><span class="plain-syntax"> *</span><span class="identifier-syntax">scope</span><span class="plain-syntax"> = </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">owning_table</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">alias_to</span><span class="plain-syntax"> = </span><a href="3-ivp.html#SP13" class="function-link"><span class="function-syntax">InterValuePairs::to_symbol</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">val</span><span class="plain-syntax">, </span><span class="identifier-syntax">scope</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="2-sym.html#SP17" class="function-link"><span class="function-syntax">InterSymbol::evaluate_to_int</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">alias_to</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> -1;</span>
<span class="plain-syntax">}</span>

<span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="function-syntax">ConstantInstruction::evaluate</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbols_table</span><span class="plain-syntax"> *</span><span class="identifier-syntax">T</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_pair</span><span class="plain-syntax"> </span><span class="identifier-syntax">val</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="3-ivp.html#SP5" class="function-link"><span class="function-syntax">InterValuePairs::is_number</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">val</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="3-ivp.html#SP4" class="function-link"><span class="function-syntax">InterValuePairs::to_number</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">val</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="3-ivp.html#SP14" class="function-link"><span class="function-syntax">InterValuePairs::is_symbolic</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">val</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">aliased</span><span class="plain-syntax"> = </span><a href="3-ivp.html#SP13" class="function-link"><span class="function-syntax">InterValuePairs::to_symbol</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">val</span><span class="plain-syntax">, </span><span class="identifier-syntax">T</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">aliased</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"bad aliased symbol"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">D</span><span class="plain-syntax"> = </span><span class="identifier-syntax">aliased</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">definition</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">D</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"undefined symbol"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">fmt</span><span class="plain-syntax"> = </span><span class="identifier-syntax">D</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">instruction</span><span class="plain-syntax">[</span><span class="constant-syntax">FORMAT_CONST_IFLD</span><span class="plain-syntax">];</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">fmt</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">CONST_LIST_FORMAT_NONE:</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">inter_pair</span><span class="plain-syntax"> </span><span class="identifier-syntax">dval</span><span class="plain-syntax"> = </span><a href="4-tcc2.html#SP8" class="function-link"><span class="function-syntax">ConstantInstruction::constant</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">D</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">e</span><span class="plain-syntax"> = </span><a href="4-tcc2.html#SP10" class="function-link"><span class="function-syntax">ConstantInstruction::evaluate</span></a><span class="plain-syntax">(</span><a href="2-pck.html#SP12" class="function-link"><span class="function-syntax">InterPackage::scope_of</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">D</span><span class="plain-syntax">), </span><span class="identifier-syntax">dval</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">e</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">CONST_LIST_FORMAT_SUM:</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">CONST_LIST_FORMAT_PRODUCT:</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">CONST_LIST_FORMAT_DIFFERENCE:</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">CONST_LIST_FORMAT_QUOTIENT:</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">                </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">result</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">=</span><span class="constant-syntax">DATA_CONST_IFLD</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="function-syntax">&lt;D-&gt;</span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">extent</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">=</span><span class="identifier-syntax">i</span><span class="plain-syntax">+2) {</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">inter_pair</span><span class="plain-syntax"> </span><span class="identifier-syntax">operand</span><span class="plain-syntax"> = </span><a href="3-ivp.html#SP19" class="function-link"><span class="function-syntax">InterValuePairs::get</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">D</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">extra</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">                        </span><a href="4-tcc2.html#SP10" class="function-link"><span class="function-syntax">ConstantInstruction::evaluate</span></a><span class="plain-syntax">(</span><a href="2-pck.html#SP12" class="function-link"><span class="function-syntax">InterPackage::scope_of</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">D</span><span class="plain-syntax">), </span><span class="identifier-syntax">operand</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> == </span><span class="constant-syntax">DATA_CONST_IFLD</span><span class="plain-syntax">) </span><span class="identifier-syntax">result</span><span class="plain-syntax"> = </span><span class="identifier-syntax">extra</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">                        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">fmt</span><span class="plain-syntax"> == </span><span class="constant-syntax">CONST_LIST_FORMAT_SUM</span><span class="plain-syntax">) </span><span class="identifier-syntax">result</span><span class="plain-syntax"> = </span><span class="identifier-syntax">result</span><span class="plain-syntax"> + </span><span class="identifier-syntax">extra</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">fmt</span><span class="plain-syntax"> == </span><span class="constant-syntax">CONST_LIST_FORMAT_PRODUCT</span><span class="plain-syntax">) </span><span class="identifier-syntax">result</span><span class="plain-syntax"> = </span><span class="identifier-syntax">result</span><span class="plain-syntax"> * </span><span class="identifier-syntax">extra</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">fmt</span><span class="plain-syntax"> == </span><span class="constant-syntax">CONST_LIST_FORMAT_DIFFERENCE</span><span class="plain-syntax">) </span><span class="identifier-syntax">result</span><span class="plain-syntax"> = </span><span class="identifier-syntax">result</span><span class="plain-syntax"> - </span><span class="identifier-syntax">extra</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">fmt</span><span class="plain-syntax"> == </span><span class="constant-syntax">CONST_LIST_FORMAT_QUOTIENT</span><span class="plain-syntax">) </span><span class="identifier-syntax">result</span><span class="plain-syntax"> = </span><span class="identifier-syntax">result</span><span class="plain-syntax"> / </span><span class="identifier-syntax">extra</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                    }</span>
<span class="plain-syntax">                }</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">result</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP11" class="paragraph-anchor"></a><b>&#167;11. Direct modification.</b>We can even change the value of a numerical constant.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">ConstantInstruction::set_int</span><button class="popup" onclick="togglePopup('usagePopup16')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup16">Usage of <span class="code-font"><span class="function-syntax">ConstantInstruction::set_int</span></span>:<br/>Symbols - <a href="2-sym.html#SP17">&#167;17</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">N</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax"> = </span><a href="2-sym.html#SP15" class="function-link"><span class="function-syntax">InterSymbol::definition</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><a href="2-in.html#SP13" class="function-link"><span class="function-syntax">Inode::is</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">CONSTANT_IST</span><span class="plain-syntax">)) &amp;&amp;</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">P</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">instruction</span><span class="plain-syntax">[</span><span class="constant-syntax">FORMAT_CONST_IFLD</span><span class="plain-syntax">] == </span><span class="constant-syntax">CONST_LIST_FORMAT_NONE</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">inter_pair</span><span class="plain-syntax"> </span><span class="identifier-syntax">val</span><span class="plain-syntax"> = </span><a href="3-ivp.html#SP19" class="function-link"><span class="function-syntax">InterValuePairs::get</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="constant-syntax">DATA_CONST_IFLD</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="3-ivp.html#SP5" class="function-link"><span class="function-syntax">InterValuePairs::is_number</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">val</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><a href="4-tcc2.html#SP8" class="function-link"><span class="function-syntax">ConstantInstruction::set_constant</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><a href="3-ivp.html#SP4" class="function-link"><span class="function-syntax">InterValuePairs::number</span></a><span class="plain-syntax">((</span><span class="constant-syntax">inter_ti</span><span class="plain-syntax">) </span><span class="identifier-syntax">N</span><span class="plain-syntax">));</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="3-ivp.html#SP14" class="function-link"><span class="function-syntax">InterValuePairs::is_symbolic</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">val</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">inter_symbols_table</span><span class="plain-syntax"> *</span><span class="identifier-syntax">scope</span><span class="plain-syntax"> = </span><span class="identifier-syntax">S</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">owning_table</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">alias_to</span><span class="plain-syntax"> = </span><a href="3-ivp.html#SP13" class="function-link"><span class="function-syntax">InterValuePairs::to_symbol</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">val</span><span class="plain-syntax">, </span><span class="identifier-syntax">scope</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><a href="2-sym.html#SP17" class="function-link"><span class="function-syntax">InterSymbol::set_int</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">alias_to</span><span class="plain-syntax">, </span><span class="identifier-syntax">N</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<nav role="progress"><div class="progresscontainer">
    <ul class="progressbar"><li class="progressprev"><a href="4-tcc.html">&#10094;</a></li><li class="progresschapter"><a href="P-wtmd.html">P</a></li><li class="progresschapter"><a href="1-bm.html">1</a></li><li class="progresschapter"><a href="2-it.html">2</a></li><li class="progresschapter"><a href="3-ic.html">3</a></li><li class="progresscurrentchapter">4</li><li class="progresssection"><a href="4-tcc.html">tcc</a></li><li class="progresscurrent">tcc2</li><li class="progresssection"><a href="4-tic.html">tic</a></li><li class="progresssection"><a href="4-tic2.html">tic2</a></li><li class="progresssection"><a href="4-tnc.html">tnc</a></li><li class="progresssection"><a href="4-toc.html">toc</a></li><li class="progresssection"><a href="4-tpc.html">tpc</a></li><li class="progresssection"><a href="4-tpc2.html">tpc2</a></li><li class="progresssection"><a href="4-tpc3.html">tpc3</a></li><li class="progresssection"><a href="4-tpc4.html">tpc4</a></li><li class="progresssection"><a href="4-tpc5.html">tpc5</a></li><li class="progresssection"><a href="4-tpc6.html">tpc6</a></li><li class="progresssection"><a href="4-tpc7.html">tpc7</a></li><li class="progresssection"><a href="4-tpc8.html">tpc8</a></li><li class="progresssection"><a href="4-ttc.html">ttc</a></li><li class="progresssection"><a href="4-tvc.html">tvc</a></li><li class="progresschapter"><a href="5-tac.html">5</a></li><li class="progresschapter"><a href="6-tpc.html">6</a></li><li class="progressnext"><a href="4-tic.html">&#10095;</a></li></ul></div>
</nav><!-- End of weave -->

		</main>
	</body>
</html>

